	
<div id="main_content">
	<h1>Playback Articles<?php if(isset($category)) echo " - $category"?></h1>
		
	<p>
		<?php if(isset($isLoggedIn)): ?>
		<?php if($isLoggedIn) echo "<a href=".site_url().'/articles/writeNewArticle>Write a new article</a>'; ?>
		<?php endif;?>
	</p>

	<?php if(isset($articles)) : ?>
	<?php foreach($articles as $row) : ?>
		<div id="article">
		<table class="article_Table">
		<tr>
		<?php if(!($row->imgRaw == '')):?>
		<td class="article_Img"><?php echo "<a href=".base_url().'userimages/'.$row->imgRaw.$row->imgExt.'>'."<img src=".base_url().'userimages/thumbs/'.$row->imgRaw.'_thumb'.$row->imgExt.' border="0"'.'></a>';?></td>
		<?php endif;?>
		</tr>
		<tr>
		<td class="article_Title"><?php echo anchor("articles/id/$row->articleID", $row->title); ?></td>
		</tr>
		<tr>
		<td class="article_Author_and_Date"><?php echo "Written by ".$this->user_model->getUsername($row->userID).' '.$row->date; ?></td>
		</tr>
		<tr>
		<?php $textPreNewLine = strstr($row->text, PHP_EOL, true)?>
		<td class="article_Text"><?php if($textPreNewLine == '') : echo substr($row->text, 0, 250) ?>
		<?php else : if(strlen($textPreNewLine) <= 250) : echo $textPreNewLine ?>
		<?php else : echo substr($textPreNewLine, 0, 250) ?>
		<?php endif; ?>
		<?php endif; ?></td>
		</tr>
		</table>
		</div>
		<hr />
		<?php endforeach; ?>
		<?php echo $page_links?>
		<?php else : ?>	
		<h3>No articles in database.</h3>
		<?php endif; ?>
</div>